import { Component, Input } from "@angular/core";
import { FormGroup } from "@angular/forms";
import { FormControlItem } from "../getControls";
import { IFieldSchemaSection } from "../json-schema";

@Component({
  template: ``,
})
export abstract class FormFieldBase<T extends IFieldSchemaSection> {
  @Input() group!: FormGroup;
  @Input() control!: FormControlItem;
  @Input() groupName?: string;
  @Input() schema?: T;

  get formControlName() {
    return this.control.key;
  }
  get title() {
    return this.schema?.title ?? this.control.key;
  }
}
